package cn.pku.sirx.snad.mss.domain.impl;

import org.apache.commons.lang.math.RandomUtils;

import cn.pku.sirx.snad.ad.domain.impl.FacadeImpl;
import cn.pku.sirx.snad.mss.dao.IArticleDao;
import cn.pku.sirx.snad.mss.domain.IArticleFacade;
import cn.pku.sirx.snad.mss.model.entity.Article;

/**
 * @author WangXiao
 */
public class ArticleFacadeImpl extends FacadeImpl<Article, IArticleDao>
		implements IArticleFacade {

	@Override
	public Article getRandomArticle() {
		int count = dao.getCount();
		long randomId = RandomUtils.nextInt(count) + 1;
		return get(randomId);
	}

}
